<div class="primary">
   <div class="wrap">
      <?php include ROOT.'/home/view/view_bar.php'?>
      <div class="breadcrumb">
         <span itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="itemscope" class="crumb_item">
            <a itemprop="url" rel="up" class="crumb" href="/"><span itemprop="title">Trang chủ</span></a>
            <span class="arrow"> &gt; </span>
         </span>
         <span itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="itemscope" class="crumb_item">
            <a itemprop="url" rel="up" class="crumb" href="/phu-kien/"><span itemprop="title">Phụ kiện</span></a>
            <span class="arrow"> &gt; </span>
         </span>
         <span itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="itemscope" class="crumb_item">
            <a itemprop="url" rel="up" class="crumb" href="/phu-kien-<?=$product_cat['cat_alias']?>/"><span itemprop="title"><?=$product_cat['cat_name']?></span></a>
            <span class="arrow"> &gt; </span>
         </span>
         <span itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="itemscope" class="crumb_item">
            <a itemprop="url" rel="up" class="crumb" href="<?=url_accessories_detail($product)?>"><span itemprop="title"><?=$product['acc_name']?></span></a>
         </span>
      </div>
      <div class="prodetail">
         <div class="prodetail_title">
            <h1><?=$product['acc_name']?></h1>
            <span class="prodetail_color">
            <?php
            if($product['acc_colors'] != '') {
               $acc_colors = json_decode(base64_decode($product['acc_colors']),1);
               ?>
               <span>(Có <?=count($acc_colors)?> màu: </span>
               <?
               foreach($acc_colors as $color) {
                  ?>
                  <span class="color_item" style="background: <?=$color['attribute_color']?>;" data-price="<?=$color['attribute_price']?>"></span>
                  <?
               }
               ?>
               <span>)</span>
               <?
            }
            ?>
               
            </span>
         </div>
         <div class="prodetail_left">
            <div class="prodetail_slide">
               <div class="prodetail_slide_item prodetail_slide_image" style="display: block;">
                  <ul class="bjqs">
                  <?php
                  if($product['acc_slides'] != '') {
                     $acc_slides = explode(',',$product['acc_slides']);
                     foreach($acc_slides as $slide) {
                        $curr_img = img_by_id($slide);
                        ?>
                        <li><img src="<?=$curr_img['src']?>" title="<?=$curr_img['caption']?>" alt="<?=$curr_img['alt']?>" /></li>
                        <?
                     }
                  }else {
                     ?>
                     <li><img src="<?=$product['acc_image']?>" title="<?=$product['acc_name']?>" alt="<?=$product['acc_name']?>" /></li>
                     <?
                  }
                  ?>
                  </ul>
               </div>
               <script class="secret-source">
               jQuery(document).ready(function($) {
                  var windowWidth = $(window).width();
                  var slidehomewidth;
                  var slidehomeheight;
                  if(windowWidth >= 980) {
                     slidehomewidth = 700;
                     slidehomeheight = 390;
                  }else if(windowWidth > 767 && windowWidth < 980) {
                     slidehomewidth = 700;
                     slidehomeheight = 390;
                  }else {
                     slidehomewidth = windowWidth - windowWidth*0.01;
                     slidehomeheight = (390/700)*slidehomewidth;
                  }
                  $('.prodetail_slide_image').bjqs({
                     animtype : 'slide',
                     height      : 390,
                     width       : 700,
                     nexttext : ' ', // Text for 'next' button (can use HTML)
                     prevtext : ' ', // Text for 'previous' button (can use HTML)
                     centermarkers : false,
                     responsive  : true
                  });
                  $('.prodetail_slide_image ol.bjqs-markers li a').html('');
               });
               </script>
               <div class="prodetail_slide_item prodetail_slide_video" style="display: none;">
               <?php
               $acc_videos = explode(';',$product['acc_videos']);
               $acc_videos = array_filter($acc_videos);
               if(count($acc_videos) > 0) {
                  $num_video = 0;
                  foreach($acc_videos as $video) {
                     $num_video++;
                     ?>
                     <div class="cont cont<?=$num_video?>" style="<?=$num_video == 1 ? 'display: block;' : 'display: none;'?>">
                        <?php if($num_video == 1):?>
                        <iframe width="100%" height="100%" src="http://www.youtube.com/embed/<?=getYouTubeIdFromURL($video)?>?rel=0" frameborder="0" allowfullscreen=""></iframe>
                        <?php endif;?>
                     </div>
                     <?php
                  }
                  ?>
                  <ul class="listthums">
                  <?php
                  $num_video = 0;
                  foreach($acc_videos as $video) {
                     $num_video++;
                     $id_video = getYouTubeIdFromURL($video);
                     ?>
                     <li>
                        <a class="thumvideo<?=$num_video == 1 ? ' active' : ''?>" data-cl="cont<?=$num_video?>" data-link="<?=$id_video?>">
                           <img class="lazy" alt="Video sản phẩm <?=$product['acc_name'].' '.$num_video?>" src="http://img.youtube.com/vi/<?=$id_video?>/1.jpg" />
                        </a>
                     </li>
                     <?
                  }
                  ?>
                  </ul>
                  <?
               }
               ?>
               </div>
               <div class="clear"></div>
               <div class="prodetail_slide_control">
                  <div class="prodetail_slide_control_item">
                     <a class="thums action_slide_image active" href="javascript:void(0)" title="Danh sách hình ảnh">
                        <b></b>
                        <i class="icon_slimage"></i>
                        <span>Hình ảnh</span>
                     </a>
                  </div>
                  <div class="prodetail_slide_control_item">
                     <a class="thums action_slide_video" href="javascript:void(0)" title="Danh sách video">
                        <b></b>
                        <i class="icon_slvideo"></i>
                        <span>Video</span>
                     </a>
                  </div>
               </div>
               <div class="count_cmt">
                  <a href="#comment">0 Bình luận</a>
               </div>
               <div class="clear"></div>
            </div><!-- prodetail_slide -->
            <div class="configuration css_content">
               <?=$product['acc_param']?>&nbsp;
               <div class="clear"></div>
            </div>
            <div class="prodetail_content css_content">
               <div class="prodetail_content_wrap">
                  <?=$product['acc_details']?>&nbsp;
               </div>
               <button type="button" class="click-show-more">Xem thêm đánh giá chi tiết ▼</button>
            </div>
            <div id="comment" class="prodetail_comment">
               <h4>Mời bạn bình luận hoặc đặt câu hỏi về <span>Samsung Galaxy Note 4</span></h4>
            </div>
         </div><!-- prodetail_left -->
         <div class="prodetail_right">
            <div class="prodetail_right_wrap">
               <h5 class="pro_instock_status"><?=$list_instock_status[$product['acc_instock_status']]?></h5>
               <h4 class="pro_price" data-price="<?=$product['acc_price']?>"><?=format_price($product['acc_price'])?></h4>
               <div class="pro_warranty"><b>Bảo hành:</b> <?=$product['acc_warranty']?></div>
               <div class="pro_promotion">
                  <?=nl2br($product['acc_promotion'])?>
               </div>
               <a class="pro_order_action" href="javascript:void(0);" onclick="showpopup(<?=$product['acc_id']?>,'accessories','<?=$product['acc_name']?>');">
                   ĐẶT MUA HÀNG TẠI CỬA HÀNG
               </a>
               <div class="pro_hotline">
                  Điên thoại: <strong>0466.565.565</strong> - Hotline: <strong>0968.655.655</strong><br>
                  <span>(7:30 - 22:00 mỗi ngày)</span>
              </div>
            </div>
            <div class="prodetail_box_sidebar">
               <div class="prodetail_right_wrap">
                  <div class="title_box">Dịch vụ sửa chữa</div>
                  <ul>
                  <?php
                  $list_hot_services = db_array('SELECT ser_id,ser_name,ser_alias,ser_image,ser_warranty FROM services WHERE ser_active = 1 ORDER BY ser_id DESC LIMIT 5');
                  foreach($list_hot_services as $service) {
                     ?>
                     <li>
                        <a class="img" href="<?=url_services_detail($service)?>">
                           <img src="<?=img_link($service['ser_image'],'small')?>" alt="<?=$service['ser_name']?>" />
                        </a>
                        <a href="<?=url_services_detail($service)?>"><h3><?=$service['ser_name']?></h3></a>
                        <p>Bảo hành: <?=$service['ser_warranty']?></p>
                     </li>
                     <?
                  }
                  ?>
                  </ul>
                  <a class="link_box" href="<?=url_services_cat()?>">Xem tất cả dịch vụ</a>
               </div>
            </div>
            <?php
            if($product['acc_tags'] != '') {
               $list_tags = explode(',',$product['acc_tags']);
               
               ?>
               <div class="pro_tags">
                  <span>Từ khóa liên quan: </span>
               <?
               foreach($list_tags as $tags) {
                  ?>
                  <a href="<?=url_tags($tags)?>" target="_blank"><?=$tags?></a>
                  <?
               }
               ?>
               </div>
               <?
            }
            ?>
         </div>
      </div>
   </div>
</div>